package cn.com.roy.thread.t3_2_4.Joinlong;

public class Test {

    public static void main(String[] args) {
        Thread myThread = new Thread(new Runnable() {
            public void run() {
                System.out.println("begin time :" + System.currentTimeMillis());
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        myThread.start();
        try {
            myThread.join(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end time:" + System.currentTimeMillis());


    }
}
